package com.hywood.manager.live.liveinterface;


import com.hywood.manager.live.entity.ChannelDto;
import com.hywood.manager.live.feignfallback.AbstractChannelFeignFallBack;
import com.hywood.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Created By HuJian on 2018/7/18
 */
@Component
@Api("channelInterface")
@FeignClient(name = "live-service", fallback = AbstractChannelFeignFallBack.class)
public interface ChannelInterface {
    /**
     * 获取频道列表
     * @param index 页码
     * @param size 分页大小
     * @return 分页后数据
     */
    @ApiOperation(value = "获取频道列表", notes = "获取频道列表")
    @RequestMapping(method = RequestMethod.GET, value = "/listchannel/{index}")
    Result listChannel(@ApiParam(value = "页码",required =true) Integer index
            ,@ApiParam(value = "分页记录数",required =true) Integer size);

    /**
     * 通过guid获取频道详细信息
     * @param guid 频道guid
     * @return 频道信息
     */
    @ApiOperation(value = "获取频道详细信息", notes = "获取频道详细信息")
    @RequestMapping(method = RequestMethod.GET, value = "/channel/{guid}")
    Result getChannelByGuid(@ApiParam(value = "频道guid",required =true) String guid);


    /**
     * 创建频道
     * @param channelDto Dto
     * @return 操作结果
     */
    @ApiOperation(value = "创建频道", notes = "创建频道")
    @RequestMapping(method = RequestMethod.POST, value = "/channel/")
    Result insertChannel(@ApiParam(value = "频道配置",required =true)ChannelDto channelDto);

    /**
     * 删除频道
     * @param guid 频道guid
     * @return 操作结果
     */
    @ApiOperation(value = "删除频道", notes = "删除频道")
    @RequestMapping(method = RequestMethod.DELETE, value = "/channel/{guid}")
    Result deleteChannel(@ApiParam(value = "频道guid",required =true)String guid);
    /**
     * 修改频道
     * @param guid 频道guid
     * @param channelDto Dto
     * @return 操作结果
     */
    @ApiOperation(value = "修改频道", notes = "修改频道")
    @RequestMapping(method = RequestMethod.PUT, value = "/channel/{guid}")
    Result updateChannel(@ApiParam(value = "频道guid",required =true)String guid,
                         @ApiParam(value = "频道配置",required =true)ChannelDto channelDto);

    /**
     * 关闭频道
     * @param guid 频道guid
     * @return 操作结果
     */
    @ApiOperation(value = "关闭频道", notes = "关闭频道")
    @RequestMapping(method = RequestMethod.PUT, value = "/closeChannel/{guid}")
    Result closeChannel(@ApiParam(value = "频道guid",required =true)String guid);

    /**
     * 查询频道列表
     * @param index 页码
     * @param size 分页大小
     * @param channelDto 查询条件
     * @return 分页后数据
     */
    @ApiOperation(value = "查询频道列表", notes = "查询频道列表(带条件)")
    @RequestMapping(method = RequestMethod.POST, value = "/channel/queries/{index}")
    Result queryChannel(@ApiParam(value = "页码",required =true)Integer index,
                        @ApiParam(value = "分页记录数",required =true)Integer size ,
                        @ApiParam(value = "查询条件，支持时间查询(查询开始时间到结束时间内的)")ChannelDto channelDto);

    /**
     * 直播上下线控制
     * @param guid 直播guid
     * @param onlineStatus 上下线状态 0未上线 1 上线
     * @return 操作结果
     */
    @ApiOperation(value = "直播上下线控制", notes = "直播上下线控制")
    @RequestMapping(method = RequestMethod.PUT, value = "/channelonline/{guid}")
    Result setChannelOnlineStatus(@ApiParam(value = "频道guid",required =true) String guid,
                                  @ApiParam(value = "上线状态，0未上线:1已上线",required =true)Integer onlineStatus);

}
